<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>$title$</title>
    <link rel="shortcut icon" type="image/x-icon" href="$resourceAddress$favicon.ico"/>

    <script type='text/javascript' src='$resourceAddress$jquery.min.js'></script>
    <script type="text/javascript" src="$resourceAddress$UnityObject2.js"></script>
    <script type="text/javascript">
        var config = {
            params:{
                enableDebugging:"0",
                backgroundcolor:"EEEEEE",
                logoimage:"$resourceAddress$logo-wdcy.png",
                disableContextMenu:true,
                disableFullscreen: false
            }

        };
        var u = new UnityObject2(config);

        jQuery(function () {

            var missingScreen = jQuery("#unityPlayer").find(".missing");
            var brokenScreen = jQuery("#unityPlayer").find(".broken");
            missingScreen.hide();
            brokenScreen.hide();

            u.observeProgress(function (progress) {
                switch (progress.pluginStatus) {
                    case "broken":
                        brokenScreen.find("a").click(function (e) {
                            e.stopPropagation();
                            e.preventDefault();
                            u.installPlugin();
                            return false;
                        });
                        brokenScreen.show();
                        break;
                    case "missing":
                        missingScreen.find("a").click(function (e) {
                            e.stopPropagation();
                            e.preventDefault();
                            u.installPlugin();
                            return false;
                        });
                        missingScreen.show();
                        break;
                    case "installed":
                        missingScreen.remove();
                        break;
                    case "first":
                        break;
                }
            });
            u.initPlugin(jQuery("#unityPlayer")[0], "$resourcePath$");
        });
    </script>
    <style type="text/css">
        <!--
        body {
            font-family: "微软雅黑", Helvetica, Verdana, Arial, sans-serif;
            background-color: white;
            color: black;
            text-align: center;
        }

        a:link, a:visited {
            color: #000;
        }

        a:active, a:hover {
            color: #666;
        }

        p.header {
            font-size: small;
        }

        p.header span {
            font-weight: bold;
        }

        p.footer {
            font-size: x-small;
        }

        div.content {
            margin: auto;
            width: 1200px;
        }

        div.broken,
        div.missing {
            margin: auto;
            position: relative;
            top: 50%;
            width: 300px;
            font-size: 12px;
        }

        div.broken a,
        div.missing a {
            height: 63px;
            position: relative;
            color: blue;
        }

        div.broken img,
        div.missing img {
            border-width: 0px;
        }

        div.broken {
            display: none;
        }

        div#unityPlayer {
            cursor: default;
            height: 800px;
            width: 1200px;
            background-color: #EEEEEE;
        }

        -->
    </style>
</head>
<body>
<p class="header"><span>$title$</span></p>

<div class="content">
    <div id="unityPlayer">
        <div class="missing">
            尚未安装播放器, 请<a href="$resourceAddress$UnityWebPlayer.exe">点此</a>下载并安装.<br/>
            安装成功后请重启浏览器.
        </div>
        <div class="broken">
            尚未安装播放器, 请<a href="$resourceAddress$UnityWebPlayer.exe">点此</a>下载并安装.<br/>
            安装成功后请重启浏览器.
        </div>
    </div>
</div>
<p class="footer">&copy; 2014 <a href="http://wdcy.cc" style="text-decoration:none;" target="_blank">维度创异</a> All Rights Reserved.</p>
<script>
    jQuery(function () {
        //adjust width and height
        var tempWidth = jQuery(window).width() - 300;
        var tempHeight = jQuery(window).height() - 90;

        if (tempWidth < 960) {
            tempWidth = 960;
        }
        if (tempHeight < 600) {
            tempHeight = 600;
        }
        //adjust to width/height = 1.6
        var adjustWidth = tempHeight * 1.6;
        if (adjustWidth > tempWidth) {
            tempHeight = tempWidth / 1.6;
        } else if (adjustWidth < tempWidth) {
            tempWidth = adjustWidth;
        }

        jQuery("div.content").css("width", tempWidth);
        jQuery("div#unityPlayer").css("width", tempWidth).css("height", tempHeight);
    });


</script>
</body>
</html>

